package com.bm.specialvehiclefordispatcher.logics;

import com.bm.corelibs.logic.BaseLogic.NListener;
import com.bm.specialvehiclefordispatcher.bean.BaseData;
import com.bm.specialvehiclefordispatcher.constants.Urls;

public class ServiceLogManager extends BaseManager {
	
	public void getOwnerDetail(long orderLogId, long ownerId, long orderId, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("ownerId", ownerId + "").addParam("orderId", orderId + "").addParam("orderLogId", orderLogId + "").setListener(l).setBaseClass(BaseData.class).setUrl(Urls.GET_OWNER_DETAIL);
		logic.doPost();
//		BaseData baseData = new BaseData();
//		baseData.status = Constant.STATUS_OK;
//		MapData mapData = new MapData();
//		
//		JobDetail detail = new JobDetail();
//		
//		App.ownerStatus++;
//		if(App.ownerStatus > 14)
//			App.ownerStatus = 1;
//		detail.statusId = App.ownerStatus;
//		
//		detail.reason = "车子坏了，没办法及时去运货！";
//		detail.totalPrice = 9560;
//		detail.totalVolume = 349;
//		
//		detail.score = 9;
//		detail.content = "好好好";
//		
//		List<ServiceLog> serviceLogs = new ArrayList<ServiceLog>();
//		for (int i = 0; i < 10; i++) {
//			ServiceLog log = new ServiceLog();
//			if(i % 2 == 0) {
//				log.distance = "30公里以内";
//				log.remarks = "热热热";
//			}
//			log.volume = 100;
//			log.realsumPrice = 999;
//			log.startTime = "2015-08-20 17:55";
//			log.status = i % 3 + 1;
//			List<Fee> fees = new ArrayList<Fee>();
//			for (int j = 0; j < 4; j++) {
//				Fee fee = new Fee();
//				fee.name = "ETC" + j;
//				fee.fee = 10;
//				fees.add(fee);
//			}
//			log.fees = fees;
//			serviceLogs.add(log);
//		}
//		
//		detail.serviceLogs = serviceLogs;
//		mapData.orderLog = detail;
//		baseData.data = mapData;
//		l.onResponse(baseData);
	}
	
	public void sign(String ownerId, long orderId, String serviceId, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("ownerId", ownerId).addParam("orderId", orderId + "").addParam("serviceId", serviceId).setListener(l).setBaseClass(BaseData.class).setUrl(Urls.SIGN);
		logic.doPost();
//		BaseData baseData = new BaseData();
//		baseData.status = Constant.STATUS_OK;
//		l.onResponse(baseData);
	}
	
	public void checkOut(String serviceId, String disId, long ownerId, long truckId, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("serviceId", serviceId).addParam("disId", disId).addParam("ownerId", ownerId + "").addParam("truckId", truckId + "").setListener(l).setBaseClass(BaseData.class).setUrl(Urls.CHECK_OUT);
		logic.doPost();
//		BaseData baseData = new BaseData();
//		baseData.status = Constant.STATUS_OK;
//		l.onResponse(baseData);
	}
	
	public void evaluate(String dispacherId, long orderId, long ownerId, int ranking, long orderLogId, String content, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("dispacherId", dispacherId).addParam("orderLogId", orderLogId + "").addParam("orderId", orderId + "").addParam("ownerId", ownerId + "").addParam("ranking", ranking + "").addParam("content", content).setListener(l).setBaseClass(BaseData.class).setUrl(Urls.EVALUATE);
		logic.doPost();
//		BaseData baseData = new BaseData();
//		baseData.status = Constant.STATUS_OK;
//		l.onResponse(baseData);
	}
	
	public void closeOwner(long orderId, long ownerId, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("orderId", orderId + "").addParam("ownerId", ownerId + "").addParam("action", "3").setListener(l).setBaseClass(BaseData.class).setUrl(Urls.ALTER_OWNER_STATUS);
		logic.doPost();
	}
}
